using TestCases.CompareAssert.Core.Comparers;
using TestCases.CompareAssert.Core.Comparers.Interfaces;
using TestCases.CompareAssert.Core.Interfaces;

namespace TestCases.Tests.Helpers
{
    public class TestComparer: IObjectComparer
    {

        public IResultSettings Settings { get; set; }
        public IObjectComparer Comparer { get; set; }

        public string Name
        {
            get { return "TestComparer"; }
        }

        public IResultBuilder Compare(ICompareContext context)
        {
            if (Settings != null)
            {
                return this.IsSameAs(Settings, context);
            }
            
            if (Comparer != null)
            {
                return Comparer.Compare(context);
            }
            return this.IsNotApplicable(context).Message("TestComparer doesn't have any settings or comparer.");
        }
    }
}